using System;
using System.Data.SQLite;
using System.IO;

namespace Elev.Core
{
    public static class SqliteConnectionStringBuilder
    {
        static string connectionStringFormat = "Data Source={0}";

        static public string GetConnectionString(string FilePath)
        {
            if (!File.Exists(FilePath))
            {
                try
                {
                    SQLiteConnection.CreateFile(FilePath);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(string.Format("Could not create the SQLite Database {0}", FilePath), ex);
                }
            }
            return string.Format(connectionStringFormat, FilePath);
        }
    }
}
